package system;

import java.io.File;

/**
 * Make path for current OS.
 * @author zem
 */
public class PathName {

    public String name;


    /**
     * Making path depending on current OS
     * @param path the path to make
     * @param type 0 - for file 1 - for folder
     */
    public PathName(String path, int type) {
         //type: 0 - for file; 1- for folder;


        char[] str = path.toCharArray();
        path = "";
        for (int i = 0; i < str.length; i++) {
            if (str[i] == '/' | str[i] == '\\') {
                str[i] = File.separatorChar;
            }
            path += str[i];
        }
        if (type == 1) {
            if (str[str.length - 1] != File.separatorChar) {
                path += File.separatorChar;
            }
        }

        name = path;
    }
}
